<?php

namespace App\Admin\Controllers;

use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;

use App\Models\ArticleCate;

class ArticleCateController extends AdminController
{
    protected $title = '推文分类';

    protected function grid()
    {
        $grid = new Grid(new ArticleCate);

        $grid->column('id', 'ID');
        $grid->column('name', '名称');
        $grid->column('created_at', '添加时间');
        $grid->column('updated_at', '更新时间');

        $grid->disableExport();

        return $grid;
    }

    protected function detail($id)
    {
        $show = new Show(ArticleCate::findOrFail($id));

        $show->field('id', 'ID');
        $show->field('name', '名称');
        $show->field('created_at', '添加时间');
        $show->field('updated_at', '更新时间');

        return $show;
    }

    protected function form()
    {
        $form = new Form(new ArticleCate);

        $form->text('name', '名称');

        return $form;
    }
}
